package com.tool_stdy.Spider;

import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.io.FileUtils;

public class TT {

	 public static  Matcher getMatcher(String targetSpider, String value) {
	        Pattern compile = Pattern.compile(targetSpider);
	        return compile.matcher(value);
	    }
	
	public static void main(String[] args) {
		try {
			String readFileToString = FileUtils.readFileToString(new File("d:/1.html"));
            String pageTargetUrl = "<a href=\"/Html/\\w+.html\" title=\"([\u4e00-\u9fa5]|/|[\u4e00-\u9fa5])+\"";
			Matcher matcher = getMatcher(pageTargetUrl, readFileToString);
			 while (matcher.find()) {
	                String urlResult = matcher.group();
	                System.out.println(urlResult);
	            }
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
